package com.aj.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.aj.entity.Comment;
import com.aj.service.CommentService;
import com.aj.util.Result;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author aj
 * @since 2020-08-03
 */
@RestController
@CrossOrigin(origins="http://localhost:8008")
@RequestMapping("/comment")
public class CommentController {
	@Autowired
	CommentService cs;

	@PostMapping("/getCommentList")
	public Result getCommentList(@RequestBody Comment c)
	{
		System.out.println(c.toString());
		return cs.getCommentList(c);
		
	}
	
	@PostMapping("/addComment")
	public Result addComment(@RequestBody Comment c)
	{
		return cs.addComment(c); 
		
	}
	
	@PostMapping("/deleteComment")
	public Result deleteComment(@RequestBody Comment c)
	{
		return cs.deleteComment(c);
		
	}
}
